package com.zjl.redis.第06章_SpringBoot整合redis;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import jakarta.annotation.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

//import javax.annotation.Resource;
import java.util.UUID;
import java.util.concurrent.ThreadLocalRandom;

/**
 * 配置文件 application-redis.properties 中
 */
@RestController
//@Api(tags = "订单接口")
public class D_RedisTemplate_Controller {
    private static final Logger log = LoggerFactory.getLogger(D_RedisTemplate_Controller.class);
    public static final String ORDER_KEY = "ord:";
    @Resource private D_RedisTemplate_Service service;

//    @ApiOperation("新增订单")
    @RequestMapping(value = "/order/add")
    public void addOrder(){
        service.addOrder();
    }
//    @ApiOperation("根据keyId查询订单")
    @RequestMapping(value = "/order/{keyId}")
    public String getOrder(@PathVariable Integer keyId){
        return service.getOrder(keyId);

    }
}
